<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>分配重复整数</title>
</head>
<body>
  <script>
    function fn(numbers, duplication) {
      let len = numbers.length;
      for (let i = 0; i < len - 1; i++) {
        for (let j = i + 1; j < len; j++) {
          if (numbers[i] === numbers[j]) {
            duplication[0] = numbers[i];
            return true
          }
        }
      }
      return false
    }
    console.log(fn([1,2,3,4], [2]))
  </script>
</body>
</html>